
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="java.util.Locale" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home Page</title>
<link rel="stylesheet" type="text/css" href="/jt-hr-WEB/css/styles.css">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="language" value="${not empty param.language ? param.language : not empty language ? language : pageContext.request.locale}" scope="session" />
<fmt:setLocale value="${language}" />
<fmt:setBundle basename="properties.text" />


</head>
<body>
    <form>
            <select id="language" name="language" onchange="submit()">
                <option value="en" ${language == 'en' ? 'selected' : ''}>English</option>
                <option value="de" ${language == 'de' ? 'selected' : ''}>Deutsch</option>
                <option value="ro" ${language == 'ro' ? 'selected' : ''}>Romana</option>
            </select>
    </form>
    
    <div id="header">
	    <div id="img">
        	<img class="center" src="/jt-hr-WEB/img/msg_header.jpg" height="100px" width="500px"/>    
    	</div>
    </div>
    
    <div class="content">
		<a href="login.jsp" style="float:right" id="button" class="login"><fmt:message key="login" /></a>
		<jsp:include page="/positionsList"></jsp:include>
			<jsp:useBean id="position" class="entityJPA.Position" scope="session"/>
		<jsp:useBean id="list" class="java.util.Vector<Position>" scope="session"/>
		<%@ page import="entityJPA.*" %>
		<%@ page import="java.util.Vector" %>
		<div id="tableWrapper" style="width:70%;margin:0 auto;margin-top:20px">
			<h3 style="text-align:center"><fmt:message key="availablePositions"/> </h3>
			<TABLE BORDER=2 style="width:75%;margin:0 auto;" class="infoTable">
			<th><fmt:message key="name" /></th>
			<th><fmt:message key="requests" /></th>
			<th><fmt:message key="responsibilities" /></th>
			<th><fmt:message key="project" /></th>
			<th><fmt:message key="numberpers" /></th>
		
			<%
			  for ( Position p : list) {
			        %>
			        <TR>
			        <TD><%= p.getName() %></TD>
			        <TD><%= p.getPositiondescription().getRequirements() %> </TD>
			        <TD><%= p.getPositiondescription().getResponsabilities() %> </TD>
			        <TD><%= p.getPositiondescription().getProject() %> </TD>
			        <TD><%= p.getNrPersons() %> </TD>
			        </TR>
			        <%
			    }
			%>	
			</TABLE>
		</div>
	</div>

<script>
	var lang='<c:out value="${language}"/>';
	select=document.getElementById("language");
	if(lang=="de_DE"||lang=="de"){
		select.options[1].defaultSelected=true;
	}
	else if(lang=="ro_RO"||lang=="ro"){
		select.options[2].defaultSelected=true;
	}
	else {
		select.options[0].defaultSelected=true;
	}

	
</script>
</body>
</html>